/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package batailledesardennes.game.entity.drawer;

import batailledesardennes.game.entity.Entity;
import batailledesardennes.util.geomFloat.Point;
import org.newdawn.slick.Animation;
import org.newdawn.slick.Graphics;

/**
 *
 * @author cghislai
 */
public class AnimatedEntityDrawer {

    protected Point imageOffset;
    protected Animation currentAnim;
    protected Entity entity;

    public void setEntity(Entity entity) {
        this.entity = entity;
    }

    public void setImageOffset(Point imageOffset) {
        this.imageOffset = imageOffset;
    }

    public void setCurrentAnim(Animation currentAnim) {
        this.currentAnim = currentAnim;
    }

    public void draw(Graphics g) {
        g.pushTransform();
        g.translate(entity.getPos().getX(), entity.getPos().getY());
        g.drawAnimation(currentAnim, imageOffset.getX(), imageOffset.getY());
        g.popTransform();
    }

    public void update(int ms) {
        currentAnim.update(ms);
    }
}
